package com.by.common.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * @author wang
 * @version 版本号 ${}
 * @className PageQuery
 * @日期 2024/9/9 14:37
 * @since jdk1.8
 */
@ApiModel (value = "分页参数")
public class PageQuery {
    @ApiModelProperty (value = "当前第几页，默认第1页", required = false)
    int page;
    @ApiModelProperty (value = "每页记录数，默认10", required = false)
    int pageSize;
    
    public int getPage() {
        if (page == 0) {
            return 1;
        }
        return page;
    }
    
    public void setPage(int page) {
        if (page <= 0) {
            this.page = 1;
            return;
        }
        this.page = page;
    }
    
    public int getPageSize() {
        if (this.pageSize == 0) {
            return 10;
        }
        return pageSize;
    }
    
    public void setPageSize(int pageSize) {
        if (pageSize <= 0) {
            this.pageSize = 10;
            return;
        }
        this.pageSize = pageSize;
    }
}
